<template>
  <div>
    <ShelfUserInfo
      :userInfo="userInfo"
      :read-day="readDay"
      :num="shelfList.length"
    ></ShelfUserInfo>
    <ShelfList
      :shelfList="shelfList"
    ></ShelfList>
  </div>
</template>

<script>
import {bookShelf} from '../../api'
import {getStorageSync} from '../../api/wechat'
import ShelfUserInfo from '../../components/shelf/ShelfUserInfo'
import ShelfList from '../../components/shelf/ShelfList'

export default {
  components: {ShelfList, ShelfUserInfo},
  data () {
    return {
      userInfo: {},
      readDay: 0,
      shelfList: []
    }
  },
  onShow () {
    this.userInfo = getStorageSync('userInfo')
    const openId = getStorageSync('openId')
    bookShelf({openId}).then(res => {
      this.shelfList = res.data.data
      this.shelfList.push({})
    })
  }
}
</script>

<style lang="stylus" scoped>
</style>
